import java.util.Arrays;
import java.util.Scanner;

public class 求逆序对的数量 {
    static int count=0;
    static int N = 100010;
    static int[] arr = new int[N];
    static int[] cpy = new int[N];
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        for (int i=0;i<n;i++) arr[i] = s.nextInt();
        gunBing(0,n-1);
        //for (int i=0;i<n;i++) System.out.println(arr[i]);
        System.out.println(count);
    }
    private static void gunBing(int l,int r) {
        if(l>=r) return;
        int mid = l+r >>1;
        gunBing(l,mid);gunBing(mid+1,r);
        int x=l;int y=mid+1;int i=0;
        while (x<=mid && y<=r) {
            if(arr[x]<=arr[y]) cpy[i++] = arr[x++];
            else {
                count+=mid-x+1;
                cpy[i++] = arr[y++];
            }
        }
        while(x<=mid) cpy[i++] = arr[x++];
        while(y<=r) cpy[i++] = arr[y++];
        for (int j=l,k=0;j<r;j++,k++) arr[j] = cpy[k];
    }

}
